<? session_start();
    include_once "../../src/facebook.php";
    //include_once "/Post.php";
	include_once "/facebookQuery.php";
	include_once "/MultiRequest.php";
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<?

	if(isset($_SESSION['facebook_s']))
	{
	  $facebook_s = $_SESSION['facebook_s'];
	  $facebook = unserialize($facebook_s);
	}
	
?>

<html>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<head>
<title>Show!!!</title>
</head>
<body>
<h3 align="right">
<a href="/"> Home </a>
</h3>
<h3 align="right">
<a href="/list.php?friends"> Friend List </a>
</h3>

<br /><br />

<? 

//Facebook Authentication
//LOGIN

if($_GET['id'])
{
	//Information about me(user) like name, bday, username, etc...
	$mrX = $_GET['id'];
	$fbQuery =	new facebookQuery($facebook);
	$fbQuery -> setSince('1262304000');
//	$fbQuery -> setUntil('1320764400');
//	$fbQuery -> setLimit('10');

	$userInfo =  $fbQuery -> myInformations();	
    $MrXPosts =  $fbQuery -> allPosts($mrX);	
	
	echo ("<br/> HELLO  ". $userInfo['name']);
	
	?><br/><br/> POSTS : <br /> <br /><?
	
	foreach($MrXPosts as $post)
	{
		?><h3><?
		echo ("MESSAGE:".$post -> message) ;
		?></h3><br/><?
		?><?
		echo ("ID POST: ".$post -> id).'<br>';
		echo ("CREATION DATE: ".$post -> created_time).'<br>';
		echo ("NUM LIKES:  ".$post -> numLikes) ;
		echo (" AND NUM COMMENTS:  ".$post -> numComments);
		?><br /> TAGS: <?
		for($i = 0 ; $i < count($post-> tags); $i++)
		{
			echo ($post-> tags[$i]['name']."(".$post -> tags[$i]['id']."), ");
		}
		?><br /> LIKES: <?
		for($i = 0 ; $i < count($post-> likes); $i++)
		{
			echo ($post -> likes[$i]['id'].',');
		}
		?><br /> COMMENT : <?
		for($i = 0 ; $i < count($post-> comments); $i++)
		{
			echo ("(".$post -> comments[$i]['from']['id'].") : ".
			$post -> comments[$i]['message']." *;* ");
		}
		
		?><br/><br/><?
	}
	
	
	
	
}
?>
</body>
</html>